#include "PauseState.h"
#include "GameplayState.h"
#include "MainMenuState.h"
#include "../DeadlyShadowsLastHope/Game.h"

CPauseState::CPauseState(void)
{

	m_nCursorMove = 0;
}

CPauseState::~CPauseState(void)
{

}

void CPauseState::Enter(void)
{
	m_pFont = new CBitmapFont();
}

void CPauseState::Exit(void)
{

}

bool CPauseState::Input(void)
{
		if (m_nCursorMove == 0)
		{
			if (m_pDI->KeyPressed(DIK_RETURN))
			{
				paused = !paused;
			}
		}

		if (curMove == 1)
		{
			if (m_pDI->KeyPressed(DIK_RETURN))
			{
				CGame::GetInstance()->AddState(CMainMenuState::GetInstance());
				CGame::GetInstance()->RemoveState(CLevelState::GetInstance());
				CGame::GetInstance()->RemoveState(this);
				return true;
			}
		}
	return true;
}

void CPauseState::Update(float fElapsedTime)
{

}

void CPauseState::Render(void)
{
	if (CGameplayState::GetInstance()->GetPaused() == true)
	{
		m_pFont->Print("PAUSED", (CGame::GetInstance()->GetWidth() * 0.5) - (strlen("PAUSED") * 32), CGame::GetInstance()->GetHeight() * 0.5f, 2.0f, D3DXCOLOR(255,255,0,255));

		if (curMove == 1)
		{
			font->Print("Resume", (CGame::GetInstance()->GetWidth() * 0.2f) - (strlen("Resume") * 32), CGame::GetInstance()->GetHeight() * 0.15f, 0.75f, D3DXCOLOR(255,255,0,255));
			font->Print("Exit", (CGame::GetInstance()->GetWidth() * 0.2f) - (strlen("EXIT") * 32), CGame::GetInstance()->GetHeight() * 0.25f, 0.75f, D3DXCOLOR(255,255,255,255));
		}

		if (curMove == 0)
		{
			font->Print("Resume", (CGame::GetInstance()->GetWidth() * 0.2f) - (strlen("Resume") * 32), CGame::GetInstance()->GetHeight() * 0.15f, 0.75f, D3DXCOLOR(255,255,255,255));
			font->Print("Exit", (CGame::GetInstance()->GetWidth() * 0.2f) - (strlen("EXIT") * 32), CGame::GetInstance()->GetHeight() * 0.25f, 0.75f, D3DXCOLOR(255,255,0,255));
		}
	}
}